return _ostree_kernel_args_to_string (kargs);
}
+static char*
+get_deployment_ostree_version (OstreeRepo *repo,
+ OstreeDeployment *deployment)
+{
+ const char *csum = ostree_deployment_get_csum (deployment);
+
+ g_autofree char *version = NULL;
+ g_autoptr(GVariant) variant = NULL;
+ if (ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, csum, &variant, NULL))
+ {
+ g_autoptr(GVariant) metadata = g_variant_get_child_value (variant, 0);
+ g_variant_lookup (metadata, OSTREE_COMMIT_META_KEY_VERSION, "s", &version);
+ }
+
+ return g_steal_pointer (&version);
+}
+
/* OSTree implements a special optimization where we want to avoid touching
* the bootloader configuration if the kernel layout hasn't changed. This is
* handled by the ostree= kernel argument referring to a "bootlink". But
* bootloader perspective.
*/
static gboolean
-deployment_bootconfigs_equal (OstreeDeployment *a,
+deployment_bootconfigs_equal (OstreeRepo *repo,
+ OstreeDeployment *a,
OstreeDeployment *b)
{
/* same kernel & initramfs? */
if (strcmp (a_boot_options_without_ostree, b_boot_options_without_ostree) != 0)
return FALSE;
+ /* same ostree version? this is just for the menutitle, we won't have to cp the kernel */
+ g_autofree char *a_version = get_deployment_ostree_version (repo, a);
+ g_autofree char *b_version = get_deployment_ostree_version (repo, b);
+ if (g_strcmp0 (a_version, b_version) != 0)
+ return FALSE;
return TRUE;
}
else
{
gboolean is_noop = TRUE;
+ OstreeRepo *repo = ostree_sysroot_repo (self);
for (guint i = 0; i < new_deployments->len; i++)
{
OstreeDeployment *cur_deploy = self->deployments->pdata[i];
if (ostree_deployment_is_staged (cur_deploy))
continue;
OstreeDeployment *new_deploy = new_deployments->pdata[i];
- if (!deployment_bootconfigs_equal (cur_deploy, new_deploy))
+ if (!deployment_bootconfigs_equal (repo, cur_deploy, new_deploy))
{
requires_new_bootversion = TRUE;
is_noop = FALSE;
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive" "syslinux"
-echo "1..6"
+echo "1..7"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
echo "ok manual cleanup"
+# Commit + upgrade twice, so that we'll rotate out the original deployment
+os_repository_new_commit "1"
+${CMD_PREFIX} ostree admin upgrade --os=testos
+oldversion=${version}
+# another commit with *same* bootcsum but *new* content
+os_repository_new_commit "1" "2"
+newversion=${version}
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf ${oldversion}
+${CMD_PREFIX} ostree admin upgrade --os=testos
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf ${newversion}
+
+echo "ok new version same bootcsum"
+
assert_n_pinned() {
local n=$1
${CMD_PREFIX} ostree admin status > status.txt